#include "LoadState.h"
#include "../Bitmap Font/BitmapFont.h"
#include "MainMenuState.h"
#include "../Game.h"

CLoadState* CLoadState::GetInstance(void)
{
	static CLoadState s_Instance;
	return &s_Instance;
}

CLoadState::CLoadState(void) { }

CLoadState::~CLoadState(void) { }

void CLoadState::Enter(void)
{
//setup the state
	m_pD3D	= CSGD_Direct3D::GetInstance();
	m_pTM	= CSGD_TextureManager::GetInstance();
	m_pDI	= CSGD_DirectInput::GetInstance();
	m_pXA	= CSGD_XAudio2::GetInstance();
	m_pTM	= CSGD_TextureManager::GetInstance();

	m_pFont = new CBitmapFont();
	m_pFont->Load("resources/XML/DeadlyShadowsFont.xml");
}

void CLoadState::Exit(void)
{
//FONTS
	if (m_pFont != nullptr)
	{
		delete m_pFont;
		m_pFont = nullptr;
	}
}

void CLoadState::Update(float fElapsedTime) { }

void CLoadState::Render(void)
{
	m_pFont->Print("Load Screen", 0,0,4.0f,D3DCOLOR_XRGB(255,0,0));
	m_pFont->Print("Test Screen", 100,100,3.0f,D3DCOLOR_XRGB(255,0,0));
}

bool CLoadState::Input(void)
{
	int key = m_pDI->GetDIKCode();
	if (m_pDI->KeyPressed(key))
	{
		CGame::GetInstance()->AddState(CMainMenuState::GetInstance());
		CGame::GetInstance()->RemoveState(this);
	}
	return true;
}